import { WrestleWeekWindom } from "./WrestleWeekWindom";
import { ILayer } from "../../../mvc/interfaces/ILayer";
import { Language } from "../../../../extend/language/Language";
import { WrestleWeekData } from "./wrestleData/WrestleWeekData";
import { MyWrestleInfo } from "./wrestleData/MyWrestleInfo";
import { DataProvider } from "../../../../fl/data/DataProvider";
import { ItemConfig } from "../../resource/ItemConfig";
import { SWrestleAccount } from "../../../../Message/Public/SWrestleAccount";
import { DateParser } from "../../../common/tools/DateParser";
//class WrestleMonthWindow
    
    export  class WrestleMonthWindow extends WrestleWeekWindom
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            title = Language.getString(42354);
            return;
        }

        protected /* override */ initDes(): void
        {
            bgHeight = 246;
            rankText = Language.getString(42353);
            rewardTxt = Language.getString(42336);
            lastRankTxt = Language.getString(42337);
            lastRewardTxt = Language.getString(42338);
            return;
        }

        protected /* override */ initDataArray(): void
        {
            _wrestleDataArray = [];
            _wrestleDataArray.push(new WrestleWeekData("1", 14011009));
            _wrestleDataArray.push(new WrestleWeekData("2", 14011010));
            _wrestleDataArray.push(new WrestleWeekData("3", 14011011));
            _wrestleDataArray.push(new WrestleWeekData("4-10", 14011012));
            _wrestleDataArray.push(new WrestleWeekData("11-20", 14011013));
            _wrestleDataArray.push(new WrestleWeekData("21-100", 14011014));
            _wrestleDataArray.push(new WrestleWeekData("101-1000", 14011015));
            this._wrestleDataArrayNewServer = [];
            this._wrestleDataArrayNewServer.push(new WrestleWeekData("1", 14011280));
            this._wrestleDataArrayNewServer.push(new WrestleWeekData("2", 14011281));
            this._wrestleDataArrayNewServer.push(new WrestleWeekData("3", 14011281));
            this._wrestleDataArrayNewServer.push(new WrestleWeekData("4-10", 14011282));
            this._wrestleDataArrayNewServer.push(new WrestleWeekData("11-20", 0));
            this._wrestleDataArrayNewServer.push(new WrestleWeekData("21-100", 0));
            this._wrestleDataArrayNewServer.push(new WrestleWeekData("101-1000", 0));
            return;
        }

        public /* override */ updateInfo(arg1: MyWrestleInfo): void
        {
            var loc1=null;
            if (arg1) 
            {
                loc1 = arg1.ex;
                if (arg1.isNewCross) 
                {
                    _tileList.dataProvider = new DataProvider(this._wrestleDataArrayNewServer);
                }
                else 
                {
                    _tileList.dataProvider = new DataProvider(_wrestleDataArray);
                }
                if (loc1) 
                {
                    if (loc1.lastMonthRankCross != 0) 
                    {
                        _tfLastRank.embedFonts = true;
                        _tfLastRank.text = loc1.lastMonthRankCross.toString();
                    }
                    else 
                    {
                        _tfLastRank.embedFonts = false;
                        _tfLastRank.htmlText = "<font color=\'#B1efff\' size=\'12\'>" + Language.getString(40344) + "</font>";
                    }
                    if (loc1.lastMonthReward) 
                    {
                        _tfLastReward.x = 310;
                        _tfLastReward.y = 170;
                        _tfLastReward.htmlText = ItemConfig.instance.getInfoByCode(loc1.lastMonthReward).htmlName;
                    }
                    else 
                    {
                        _tfLastReward.x = 402;
                        _tfLastReward.y = 150;
                        _tfLastReward.text = Language.getString(40344);
                    }
                }
            }
            return;
        }

        public /* override */ updateAccount(arg1: SWrestleAccount): void
        {
            _tfDate.htmlText = DateParser.parse(arg1.monthAccountDt, Language.getString(42335));
            return;
        }

        public static hasInstance(): Boolean
        {
            return !(WrestleMonthWindow._instance == null);
        }

        public static get instance(): WrestleMonthWindow
        {
            if (!WrestleMonthWindow._instance) 
            {
                WrestleMonthWindow._instance = new WrestleMonthWindow();
            }
            return WrestleMonthWindow._instance;
        }

        protected /* var */_wrestleDataArrayNewServer: Array<any>;

        /* internal */ static /* var */_instance: WrestleMonthWindow;
    }
